package routers

import (
	"beegoProject09/controllers"
	"beegoProject09/controllers/auth"
	"beegoProject09/controllers/login"
	"beegoProject09/controllers/user"
	"github.com/astaxie/beego"
)

func init() {
	/*
		不需要登录即可请求到url
	*/
	// 登录用户名密码提交
	beego.Router("/", &login.LoginController{})
	// ChangeCaptcha
	beego.Router("/change_captcha", &login.LoginController{}, "get:ChangeCaptcha")

	/*
		必须登录即可请求到url
	*/
	// 首页
	beego.Router("/main/index", &controllers.HomeController{})
	// 欢迎页
	beego.Router("/main/welcome", &controllers.HomeController{}, "get:Welcome")

	/*
		user用户模块
	*/
	beego.Router("/main/user/list", &user.UserController{}, "get:List")
	beego.Router("/main/user/to_add", &user.UserController{}, "get:ToAdd")
	beego.Router("/main/user/do_add", &user.UserController{}, "post:DoAdd")
	// 用户启停
	beego.Router("/main/user/is_active", &user.UserController{}, "post:IsActive")
	// 用户删除
	beego.Router("/main/user/delete", &user.UserController{}, "get:Delete")
	// 用户密码修改
	beego.Router("/main/user/reset_pwd", &user.UserController{}, "get:ResetPassword")
	// 用户编辑
	beego.Router("/main/user/to_edit", &user.UserController{}, "get:ToUpdate")
	// 获取用户编辑数据-->写入数据库
	beego.Router("/main/user/do_edit", &user.UserController{}, "post:DoUpdate")
	// 批量删除路由
	beego.Router("/main/user/muli_delete", &user.UserController{}, "post:MuLiDelete")

	/*
		auth模块
	*/
	// 权限列表
	beego.Router("/main/auth/list", &auth.AuthController{}, "get:List")
	// 页面添加方法
	beego.Router("/main/auth/to_add", &auth.AuthController{}, "get:ToAdd")
	// 页面获取数据方法
	beego.Router("/main/auth/do_add", &auth.AuthController{}, "post:DoAdd")

}
